package com.informix.stream.api.records;

import com.informix.stream.api.IfmxStreamRecord;
import com.informix.stream.common.enums.IfmxStreamRecordType;
import java.nio.ByteBuffer;

public class IfxCDCErrorRecord extends IfxCDCRecord implements IfmxStreamRecord {
  private final int flags;
  private final int error;

  public IfxCDCErrorRecord(byte[] header) {
    super(IfmxStreamRecordType.ERROR);
    ByteBuffer buffer = ByteBuffer.wrap(header);
    this.flags = buffer.getInt();
    this.error = buffer.getInt();
  }

  public int getError() {
    return this.error;
  }

  public int getFlags() {
    return this.flags;
  }

  @Override
  public String toString() {
    return super.toString() + " Error: [" + this.error + "] Flags: [" + this.flags + "]";
  }
}
